package com.zx._12_算法.剑指offer._2022;

/**
 * https://leetcode.cn/problems/fan-zhuan-dan-ci-shun-xu-lcof/
 */
public class 翻转单词顺序 {

    public String reverseWords(String s) {
        String[] ss = s.trim().split(" ");
        String res = "";
        for (int i = ss.length - 1; i >= 0; i--) {
            if (!ss[i].equals("")) {
                res += ss[i] + " ";
            }
        }
        return res.trim();
    }
}
